package net.example.model;

import com.oraycn.omcs.utils.SerializeUtils;

import net.example.utils.SerializeHelper;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import io.netty.buffer.ByteBuf;

public class GroupOfflineMessage {

    public String GroupID ;
    public List<OfflineMessage> OfflineMessages ;

    public void deserialize(byte[] info) throws IOException {
        ByteBuf buffer = SerializeHelper.wrappedBuffer(info);
        buffer.readInt();
        this.GroupID= SerializeUtils.readStrIntLen(buffer);
        int count = buffer.readInt();
        this.OfflineMessages = new ArrayList<>();
        for (int i = 0; i < count; i++) {
            OfflineMessage offlineMessage = new OfflineMessage();
            offlineMessage.deSerialize(buffer);
            this.OfflineMessages.add(offlineMessage);
        }

    }
}
